
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
 */
package insertionsort;

/**
 *
 * @author nikhil
 */
public class UserMainCode {
    public static int[] output;

    public static void insertionSort(int[] array) {
        int key, i, j;

        for (j = 1; j < array.length; j++) {
            key = array[j];
            i   = j;

            while ((i > 0) && (array[i-1] > key)) {
                array[i] = array[i-1];
                i--;
            }

            array[i] = key;
        }

        output = array;
    }
}
